package com.deyou.callback;

import com.deyou.util.Urls;
import com.lzy.okgo.model.HttpHeaders;
import com.lzy.okgo.model.HttpMethod;
import com.lzy.okgo.model.HttpParams;

import java.lang.reflect.Type;
import io.reactivex.Observable;

/**
 * ================================================
 * 作    者：jeasonlzy（廖子尧）Github地址：https://github.com/jeasonlzy
 * 版    本：1.0
 * 创建日期：16/9/30
 * 描    述：
 * 修订历史：
 * ================================================
 */
public class ServerApi {


    public static Observable<String> getString(String url, String header, String param) {
        HttpHeaders headers = new HttpHeaders();
        headers.put("aaa", header);
        HttpParams params = new HttpParams();
        params.put("param", param);
        return RxUtils.request(HttpMethod.POST, url, String.class, params, headers);
    }

    public static <T> Observable<T> getData(Type type, String url, String header, String param) {
        HttpHeaders headers = new HttpHeaders();
        headers.put("aaa", header);
        HttpParams params = new HttpParams();
        params.put("param", param);
        return RxUtils.request(HttpMethod.POST, url, type, params, headers);
    }
}
